package day2.Exer;
import java.util.Scanner;

public class Exer1 {
    public static void main(String[] args) {
        Scanner in = new Scanner(System.in);
        System.out.println("请输入第一个字符串：");
        String str = in.next();
        System.out.println("请输入第二个字符串：");
        String str1 =in.next();
        int count = 0;
        if(str.contains(str1)){
            int i=0;
            while(str.indexOf(str1,i)>=0){
                i=str.indexOf(str1,i)+str1.length;
                count++;
            }
            System.out.println(str1+"一共在"+str+"中出现"+count+"次。");
        }else{
            System.out.println(str+"中不包含"+str1);
        }
  }
}
